import 'package:flutter/material.dart';
import 'package:jetour_line/base_widget/base_image.dart';
import 'package:jetour_line/utils/extension_int.dart';

import '../my_colors.dart';

BaseAppBar(BuildContext context, {String? title,Widget? titleWidget, Function? leftItemCallBack, Function? rightItemCallBack}) {

  return AppBar(
    title:titleWidget?? Text(
      title ?? '',
      style: const TextStyle(fontSize: 17, color: Colors.black),
    ),
    elevation: 0.0,
    centerTitle: true,
    backgroundColor: MyColors.white,
    leading: IconButton(
      alignment: Alignment.centerLeft,
      icon: Padding(
          padding: EdgeInsets.only(left: 26.rpx),
          child: const BaseImage(image: 'back_icon',width: 20,height: 20,)),
      padding: EdgeInsets.zero,
      onPressed: () {
        if(leftItemCallBack != null){
          leftItemCallBack();
        }else{
          Navigator.pop(context);
        }

      },
    ),
  );
}
